package ve.ejb.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author memozac
 */
@Entity
public class Alert implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idAlert;

    @ManyToOne
    @JoinColumn(name="idScoreCard",nullable=false,updatable=true)
    private ScoreCard scoreCard;

    @ManyToOne
    @JoinColumn(name="idPerson",nullable=false,updatable=true)
    private Person person;

    @Temporal(value = TemporalType.TIMESTAMP)
    private Date suscriptionDate;

    public Date getSuscriptionDate() {
        return suscriptionDate;
    }

    public void setSuscriptionDate(Date suscriptionDate) {
        this.suscriptionDate = suscriptionDate;
    }

    public Long getIdAlert() {
        return idAlert;
    }

    public void setIdAlert(Long idAlert) {
        this.idAlert = idAlert;
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }
    
    public ScoreCard getScoreCard() {
        return scoreCard;
    }

    public void setScoreCard(ScoreCard scoreCard) {
        this.scoreCard = scoreCard;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAlert != null ? idAlert.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Alert)) {
            return false;
        }
        Alert other = (Alert) object;
        if ((this.idAlert == null && other.idAlert != null) || (this.idAlert != null && !this.idAlert.equals(other.idAlert))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ve.ejb.entity.ScoreCardDomain[id=" + idAlert + "]";
    }

}//ends of class
